﻿using System;

class AnyBaseNumberToAnyBaseNumber
{
    static void Main()
    {
        int s = 16;
        int d = 14;
        string binaryNumber = "1e0f3";
        int decimalNumber = 0;

        for (int i = 0; i < binaryNumber.Length; i++)
        {
            string str = binaryNumber[binaryNumber.Length - 1 - i].ToString().ToLower();
            str = TurnLettersInNumbers(str);

            int letter = int.Parse(str);
            decimalNumber += letter * (int)Math.Pow(s, i);
        }
        string result = "";
        while (decimalNumber != 0)
        {
            result += TurnNumberInLetters((decimalNumber % d).ToString());
            decimalNumber /= d;
        }
        char[] reversedArray = result.ToCharArray();
        Array.Reverse(reversedArray);
        result = new string(reversedArray);
        Console.WriteLine(result);
    }
  
    private static string TurnLettersInNumbers(string str)
    {
        switch (str)
        {
            case "a":
                str = "10";
                break;
            case "b":
                str = "11";
                break;
            case "c":
                str = "12";
                break;
            case "d":
                str = "13";
                break;
            case "e":
                str = "14";
                break;
            case "f":
                str = "15";
                break;
        }
        return str;
    }
    private static string TurnNumberInLetters(string str)
    {
        switch (str)
        {
            case "10":
                str = "a";
                break;
            case "11":
                str = "b";
                break;
            case "12":
                str = "c";
                break;
            case "13":
                str = "d";
                break;
            case "14":
                str = "e";
                break;
            case "15":
                str = "f";
                break;
        }
        return str;
    }
}
